package com.interview.spring.proxy;

import com.sun.beans.WeakCache;
import sun.misc.ProxyGenerator;

import java.lang.reflect.Proxy;
import java.util.Objects;

/**
 * @author: zsg
 * @description:
 * @date: 2019/11/30 21:16
 * @modified:
 */
public class Test {

    public static void main(String[] args) {
        // 保存生成的代理类的字节码文件
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");
        TestProxy testProxy = new TestProxy(new TestProxyDaoImpl());
        TestProxyDao proxy = testProxy.getProxy();
        System.out.println(proxy.test());
        TestProxy testProxy1 = new TestProxy(new TestProxyDaoImpl());
        TestProxyDao proxy1 = testProxy1.getProxy();
        System.out.println(proxy1.test());
//        UserDaoImpl userDao = new UserDaoImpl();
//        ProxyUserDao proxyUserDao = new ProxyUserDao(userDao);
//        proxyUserDao.query("byteblogs");
    }
}
